<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<?php if($type == 'logout') : ?>
	<li>
	<form action="<?php echo JRoute::_('index.php', true, $params->get('usesecure')); ?>" method="post" name="form-login" id="login-form">
<?php if ($params->get('greeting')) : ?>
	<?php if($params->get('name') == 0) : {
		echo JText::sprintf('HINAME', $user->get('name'));
	} else : {
		echo JText::sprintf('HINAME', $user->get('username'));
	} endif; ?>
<?php endif; ?>
		<input type="submit" name="Submit" class="button logout-button" value="<?php echo JText::_('JLOGOUT'); ?>" />
	<input type="hidden" name="option" value="com_users" />
	<input type="hidden" name="task" value="user.logout" />
	<input type="hidden" name="return" value="<?php echo $return; ?>" />
	<?php echo JHtml::_('form.token'); ?>
</form>
	</li>
<?php else : ?>
	<li>
		<a class="login-switch" href="<?php echo JRoute::_('index.php?option=com_user&view=login');?>" onclick="showBox('ja-user-login','mod_login_username',this, window.event || event);return false;" title="<?php JText::_('Login');?>"><span>Login</span></a>
	
	<!--LOFIN FORM content-->
	<div id="ja-user-login" style="width:370px;">
	<?php if(JPluginHelper::isEnabled('authentication', 'openid')) : ?>
        <?php JHTML::_('script', 'openid.js'); ?>
    <?php endif; ?>
	  <form action="<?php echo JRoute::_('index.php', true, $params->get('usesecure')); ?>" method="post" name="form-login" id="login-form" >
	<div class="pretext">
	<?php echo $params->get('pretext'); ?>
	</div>
	<fieldset class="userdata">
	<label for="modlgn-username" class="ja-login-user" id="form-login-username">
		<span><?php echo JText::_('Username') ?>:</span><br/>
		<input id="modlgn-username" type="text" name="username" class="inputbox"  size="18" />
	</label>
	<label for="modlgn-passwd" class="ja-login-password" id="form-login-password">
    	<span><?php echo JText::_('Password') ?>: </span> <br />
        <input type="password" id="modlgn-passwd" name="password" class="inputbox" size="20" alt="password" />
    </label>
	<?php if (JPluginHelper::isEnabled('system', 'remember')) : ?>
	<label for="modlgn-remember" id="form-login-remember">
		
		<input id="modlgn-remember" type="checkbox" name="remember" class="inputbox" value="yes"/>
	</label>
	<?php endif; ?>
	<input type="submit" name="Submit" class="button" value="<?php echo JText::_('JLOGIN') ?>" />
	<input type="hidden" name="option" value="com_users" />
	<input type="hidden" name="task" value="user.login" />
	<input type="hidden" name="return" value="<?php echo $return; ?>" />
	<?php echo JHtml::_('form.token'); ?>
	</fieldset>
		                <div class="ja-login-links clearfix">
							<a href="<?php echo JRoute::_('index.php?option=com_users&view=reset'); ?>">
								<?php echo JText::_('FORGOT_YOUR_PASSWORD'); ?></a>
                			<a href="<?php echo JRoute::_('index.php?option=com_users&view=remind'); ?>">
								<?php echo JText::_('FORGOT_YOUR_USERNAME'); ?></a>
                <?php 
                    $usersConfig = &JComponentHelper::getParams( 'com_users' );
                    if ($usersConfig->get('allowUserRegistration')) : ?>
                    <a href="<?php echo JRoute::_('index.php?option=com_users&view=registration'); ?>">
						<?php echo JText::_('REGISTER'); ?></a>
                <?php endif; ?>
                </div>
	        <?php echo $params->get('posttext'); ?>
	    </form>
    </div>
		
	</li>
	<?php 
				$option = JRequest::getCmd('option');
				$task = JRequest::getCmd('task');
				if($option!='com_user' && $task != 'register') { ?>
	<li>
		<a class="register-switch" href="<?php echo JRoute::_("index.php?option=com_users&task=registration");?>" onclick="showBox('ja-user-register','namemsg',this, window.event || event);return false;" >
			<span><?php echo JText::_('REGISTER');?></span>
		</a>
		<!--LOFIN FORM content-->
		<script type="text/javascript" src="<?php echo JURI::base();?>media/system/js/validate.js"></script>
		<div id="ja-user-register" style="width:370px;">
				<script type="text/javascript">
				/*
					Window.onDomReady(function(){
						document.formvalidator.setHandler('passverify', function (value) { return ($('password').value == value); }	);
					});
				*/
				</script>
				
				<?php
					///if(isset($this->message)){
					//	$this->display('message');
					//}
				?>
				<form id="member-registration" action="<?php echo JRoute::_('index.php?option=com_users&task=registration.register'); ?>" method="post" class="form-validate">
		<fieldset>
		<?php if (isset($fieldset->label)):// If the fieldset has a label set, display it as the legend.?>
			<legend><?php echo JText::_($fieldset->label);?></legend>
		<?php endif;?>
				<table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
				<tr>
					<td width="30%">
							<label class="hasTip required" for="jform_name" id="jform_name-lbl" title="Name&lt;br&gt;Enter your full name">
						<?php echo JText::_( 'Name' ); ?>:</label>						
					</td>
					<td><input type="text" size="30" value="" class="inputbox required" maxlength="50" id="jform_name" name="jform[name]" /><span class="red">*</span></td>
				</tr>
				<tr>
					<td><label title="" class="hasTip required" for="jform_username" id="jform_username-lbl">
						<?php echo JText::_( 'Username' ); ?>:</label></td>
					<td><input type="text" size="30" class="inputbox required" value="" id="jform_username" name="jform[username]" /><span class="red">*</span></td>
				</tr>
				<tr>
					<td><label title="" class="hasTip required" for="jform_password1" id="jform_password1-lbl">
						<?php echo JText::_( 'Password' ); ?>:</label></td>
					<td><input type="password" size="30" class="inputbox required" value="" id="jform_password1" name="jform[password1]" /><span class="red">*</span>
					</td>
				</tr>
				<tr>
					<td><label title="" class="hasTip required" for="jform_password2" id="jform_password2-lbl">
						<?php echo JText::_( 'Confirm Password' ); ?>:</label></td>
					<td><input type="password" size="30" class="inputbox required" value="" id="jform_password2" name="jform[password2]" /><span class="red">*</span></td>
				</tr>
				<tr>
					<td><label title="" class="hasTip required" for="jform_email1" id="jform_email1-lbl"><?php echo JText::_( 'Email' ); ?>:</label></td>
					<td><input type="text" size="30" class="inputbox required" value="" id="jform_email1" name="jform[email1]" /><span class="red">*</span></td>
				</tr>
				<tr>
					<td><label title="" class="hasTip required" for="jform_email2" id="jform_email2-lbl">
						<?php echo JText::_( 'Confirm email Address'); ?>:</label></td>
					<td><input type="text" size="30" class="inputbox required" value="" id="jform_email2" name="jform[email2]" /><span class="red">*</span></td>
				</tr>
			</table>
		</fieldset>
		<br />
		<p><?php echo "Fields marked with an asterisk (*) are required."; ?></p>
		<button type="submit" class="button validate"><?php echo JText::_('REGISTER');?></button>
		<div>
			<input type="hidden" name="option" value="com_users" />
			<input type="hidden" name="task" value="registration.register" />
			<?php echo JHtml::_('form.token');?>
		</div>
	</form>
				<!-- Old code -->
		</div>
	</li>
	<?php } ?>
		<!--LOFIN FORM content-->
<?php endif; ?>